package org.zhangsh.common;

import lombok.extern.slf4j.Slf4j;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * </p>
 *
 * @author zhangsh
 * @version 1.0.0
 * @since 2019-01-04
 */
@Slf4j
public final class IpUtil {

    public static final String getLocalIp(){
        try {
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
            log.error("Failed to retriving ip address: {}", e.getMessage());
            e.printStackTrace();
            return null;
        }
    }
}
